package org.zwt.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.zwt.common.enumerate.HttpVersion;
import org.zwt.common.enumerate.ResponseStatus;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class HttpResponse {
    private HttpVersion version;
    private ResponseStatus status;
    private Map<String, String> headers = new HashMap<String, String>();
    private String body;
//--------------------------------------------------
    public Set<String> getHeaderNames() {
        return this.headers.keySet();
    }
    public String getHeader(String name){
        return this.headers.get(name);
    }
    public void setHeader(String name,String value) {
        this.headers.put(name,value);
    }




//--------------------------------------------------

    @Override
    public String toString() {
        return "HttpResponse{" +
                "version=" + version +
                ", status=" + status +
                ", headers=" + headers +
                ", body='" + body + '\'' +
                '}';
    }
}
